<template>
	<view>
		<!-- #ifdef H5 -->
		<uni-nav-bar left-icon="back" @clickLeft="back" :border="false"  title="反馈"></uni-nav-bar>
		<view class="title">意见反馈</view>
		<!-- #endif -->
		<input class="input"  placeholder="请输入CDK兑换码" confirm-type="send" @input="getValue"></input>
		<view class="btn" bindtap="cashoutBtn" @click="sendContent">立即兑换</view>
	</view>
</template>

<script>
import Login from '../../utils/login.js';
import Route from '../../utils/route.js';
	export default {
		data() {
			return {
				content:''
			}
		},
		methods: {
			// 获取内容
			getValue(e){
				this.content = e.detail.value
			},
			//立即兑换
			async sendContent(){
				await Login.isLogin();
				await Route.cdk({
					key:this.content,
					uid:uni.getStorageSync('userInfo').uid
				})
				uni.showToast({
					title: '兑换成功',
					icon: 'none'
				});
				let settime = setTimeout(()=>{
					clearTimeout(settime)
					uni.navigateTo({
						url:'../coupon/coupon'
					})
				},1500)
			},
			// 返回
			back(){
				uni.navigateBack()
			},
		}
	}
</script>

<style lang="scss">
.title{
	font-size: 32rpx;
	text-align: center;
	background: #fff;
	font-weight: 900;
	padding: 33rpx;
	margin: 33rpx 0;
}
.input{
	width: 690rpx;
	margin: 0 auto;
	padding: 8rpx;
	border-radius: 8rpx;
	border: 1rpx solid $template-line;
	margin-top: 33rpx;
}
.btn {
	font-size: $uni-font-size-base;
	background: $template-background;
	color: #fff;
	width: 333rpx;
	height: 81rpx;
	line-height: 81rpx;
	text-align: center;
	border-radius: 40rpx;
	margin: 0 auto;
	margin-top: 81rpx;
}
</style>
